//
//  YZLHotCarListTableViewCell.m
//  Car
//
//  Created by dllo on 15/10/28.
//  Copyright © 2015年 岳明. All rights reserved.
//

#import "YZLHotCarListTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface YZLHotCarListTableViewCell ()

@property (nonatomic, strong) UIImageView *leftImage;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *costLabel;

@end

@implementation YZLHotCarListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.leftImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.leftImage];
        
        self.nameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.nameLabel];
        
        self.costLabel = [[UILabel alloc] init];
        self.costLabel.textColor = [UIColor orangeColor];
        self.costLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.costLabel];
    }
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    self.leftImage.frame = CGRectMake(10, 10, 50, 40);
    self.nameLabel.frame = CGRectMake(70, 10, 150, 20);
    self.costLabel.frame = CGRectMake(70, 35, 150, 20);
    
}

- (void)setModel:(YZLHotCarListModel *)model {
    
    if (_model != model) {
        _model = model;
    }
    
    NSDictionary *dic = [self.model.series objectAtIndex:self.listNum];
    self.nameLabel.text = [dic objectForKey:@"seriesName"];
    self.costLabel.text = [dic objectForKey:@"seriesPrice"];
    NSURL *url = [NSURL URLWithString:[dic objectForKey:@"seriesIcon"]];
    [self.leftImage sd_setImageWithURL:url];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
